package com.zrf.springCloudTest.controller;

import com.zrf.springCloudTest.service.ComputeService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zrf
 *         Created by zrf on 2016/8/28.
 */
@RestController
public class ConsumerController {
    /**
     * 服务
     */
    @Resource
    private ComputeService computeService;

    /**
     * 添加方法
     * @param a 参数a
     * @param b 参数b
     * @return a+b
     */
    @RequestMapping("/add")
    public String add(@RequestParam("a") Integer a, @RequestParam("b") Integer b){
//        return restTemplate.getForEntity("http://COMPUTE-SERVICE/add?a="+ a +"&b=" + b, String.class).getBody();
        return computeService.add(a, b);
    }
}
